var t = require;
var e = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0});
var n = t("Platforms"),
    r = t("Sounds"),
    a = t("ConfS"),
    i =
        (t("main"),
        (function () {
            function t() {
                (this.MusicIsOpen = !0),
                    (this.SoundIsOpen = !0),
                    (this.jb = a.DatasManager.初始金币),
                    (this.zs = a.DatasManager.初始钻石),
                    (this.上一次免费抽奖的时间戳 = 0),
                    (this.所有抽奖宝箱的领取时间 = {}),
                    (this.旋转转盘时间记录 = []),
                    (this.礼包可领取时间戳 = 0),
                    (this.goldAddTimes = []),
                    (this.diamondAddTimes = []),
                    (this.连续签到的次数 = 0),
                    (this.上一次签到的时间戳 = 0),
                    (this.所有已完成的引导 = []),
                    (this.hero = null),
                    (this.heros = []),
                    (this.equips = []),
                    (this.skillLvs = {}),
                    (this.herolvs = {}),
                    (this.fubens = []),
                    (this.zpIsOpen = !0),
                    (this.送金刚启动时间 = 0),
                    (this.送金刚广告次数 = 0),
                    (this.送金刚是否完成 = !1),
                    (this.第一场战斗说明是否完成 = !1),
                    (this.herovideounlock = {}),
                    (this.herohelp = null),
                    (this.herolvexchangevideocount = 0);
            }
            return (
                (t.getData = function (e) {
                    var o = t.ungzip(e);
                    return t.ungzip(o.gameData);
                }),
                (t.ungzip = function (t) {
                    var e = pako.ungzip(n.default.base64Decode(t.replace(/ /g, "+")), {to: "string"});
                    return JSON.parse(e);
                }),
                (t.getStore = function (t) {
                    n.default.platformCtrl.getStore(function () {
                        if (n.default.userStorage.gameData) {
                            var e = pako.ungzip(
                                    n.default.base64Decode(n.default.userStorage.gameData.replace(/ /g, "+")),
                                    {to: "string"}
                                ),
                                o = JSON.parse(e);
                            t(o);
                        } else t(null);
                    });
                }),
                (t.setStore = function () {
                    console.log("存游戏数据到服务器");
                    var e = JSON.stringify(t.Inst);
                    (n.default.userStorage.gameData = n.default.base64Encode(pako.gzip(e, {to: "string"}))),
                        n.default.platformCtrl.setStore();
                }),
                (t.deleteStore = function () {
                    n.default.platformCtrl.deleteStore(null);
                }),
                (t.getEventCount = function () {
                    var t = 0;
                    for (var e in this) {
                        if (e.indexOf("_EventList") > -1) t += this[e].length;
                    }
                    return t;
                }),
                (t.Clear = function () {
                    cc.sys.localStorage.removeItem("GameData"), (t.Inst = new t()), (t.newData = !0);
                }),
                (t.onInit = function (e, o) {
                    var a = this,
                        i = new t(),
                        s = cc.sys.localStorage.getItem("GameData");
                    if (null == s || void 0 == s || "" == s)
                        this.getStore(function (s) {
                            null == s ? ((t.Inst = i), (t.newData = !0)) : (t.Inst = s),
                                (n.default.userStorage.musicOn = t.MusicIsOpen),
                                r.Sounds.updateMusic(),
                                (n.default.userStorage.soundOn = t.SoundIsOpen),
                                a.onSave(),
                                o.call(e);
                        });
                    else {
                        for (var c in ((t.Inst = JSON.parse(s)), i)) {
                            var l = i[c];
                            void 0 === t.Inst[c] && (t.Inst[c] = l);
                        }
                        (n.default.userStorage.musicOn = t.MusicIsOpen),
                            r.Sounds.updateMusic(),
                            (n.default.userStorage.soundOn = t.SoundIsOpen),
                            this.onSave(),
                            o.call(e);
                    }
                }),
                (t.onSave = function () {
                    var e = JSON.stringify(t.Inst);
                    cc.sys.localStorage.setItem("GameData", e);
                }),
                (t.on = function (e, o, n, r) {
                    void 0 === r && (r = !1);
                    var a = t[e + "_EventList"];
                    if (!a) throw new Error("not find EventList => " + e);
                    a.push({the: o, fun: n}), r && n.call(o, t[e]);
                }),
                (t.off = function (e, o, n) {
                    var r = t[e + "_EventList"];
                    if (!r) throw new Error("not find EventList => " + e);
                    for (var a = 0; a < r.length; a++) {
                        var i = r[a];
                        if (i.the == o && i.fun == n) return void r.splice(a, 1);
                    }
                }),
                (t.event = function (e) {
                    var o = t[e + "_EventList"];
                    if (!o) throw new Error("not find EventList => " + e);
                    for (var n = 0; n < o.length; n++) {
                        var r = o[n];
                        r.fun.call(r.the);
                    }
                    this.onSave();
                }),
                Object.defineProperty(t, "MusicIsOpen", {
                    get: function () {
                        return t.Inst.MusicIsOpen;
                    },
                    set: function (e) {
                        (t.Inst.MusicIsOpen = e),
                            (n.default.userStorage.musicOn = t.MusicIsOpen),
                            r.Sounds.updateMusic(),
                            t.event("MusicIsOpen");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "SoundIsOpen", {
                    get: function () {
                        return t.Inst.SoundIsOpen;
                    },
                    set: function (e) {
                        (t.Inst.SoundIsOpen = e),
                            (n.default.userStorage.soundOn = t.SoundIsOpen),
                            t.event("SoundIsOpen");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "jb", {
                    get: function () {
                        return t.Inst.jb;
                    },
                    set: function (e) {
                        (t.Inst.jb = e), t.event("jb");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "zs", {
                    get: function () {
                        return t.Inst.zs;
                    },
                    set: function (e) {
                        (t.Inst.zs = e), t.event("zs");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "上一次免费抽奖的时间戳", {
                    get: function () {
                        return t.Inst.上一次免费抽奖的时间戳;
                    },
                    set: function (e) {
                        (t.Inst.上一次免费抽奖的时间戳 = e), t.event("上一次免费抽奖的时间戳");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "所有抽奖宝箱的领取时间", {
                    get: function () {
                        return t.Inst.所有抽奖宝箱的领取时间;
                    },
                    set: function (e) {
                        (t.Inst.所有抽奖宝箱的领取时间 = e), t.event("所有抽奖宝箱的领取时间");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "旋转转盘时间记录", {
                    get: function () {
                        return t.Inst.旋转转盘时间记录;
                    },
                    set: function (e) {
                        (t.Inst.旋转转盘时间记录 = e), t.event("旋转转盘时间记录");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "礼包可领取时间戳", {
                    get: function () {
                        return t.Inst.礼包可领取时间戳;
                    },
                    set: function (e) {
                        (t.Inst.礼包可领取时间戳 = e), t.event("礼包可领取时间戳");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "goldAddTimes", {
                    get: function () {
                        return t.Inst.goldAddTimes;
                    },
                    set: function (e) {
                        (t.Inst.goldAddTimes = e), t.event("goldAddTimes");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "diamondAddTimes", {
                    get: function () {
                        return t.Inst.diamondAddTimes;
                    },
                    set: function (e) {
                        (t.Inst.diamondAddTimes = e), t.event("diamondAddTimes");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "连续签到的次数", {
                    get: function () {
                        return t.Inst.连续签到的次数;
                    },
                    set: function (e) {
                        (t.Inst.连续签到的次数 = e), t.event("连续签到的次数");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "上一次签到的时间戳", {
                    get: function () {
                        return t.Inst.上一次签到的时间戳;
                    },
                    set: function (e) {
                        (t.Inst.上一次签到的时间戳 = e), t.event("上一次签到的时间戳");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "所有已完成的引导", {
                    get: function () {
                        return t.Inst.所有已完成的引导;
                    },
                    set: function (e) {
                        (t.Inst.所有已完成的引导 = e), t.event("所有已完成的引导");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "hero", {
                    get: function () {
                        return t.Inst.hero;
                    },
                    set: function (e) {
                        (t.Inst.hero = e), t.event("hero");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "heros", {
                    get: function () {
                        return t.Inst.heros;
                    },
                    set: function (e) {
                        (t.Inst.heros = e), t.event("heros");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "equips", {
                    get: function () {
                        return t.Inst.equips;
                    },
                    set: function (e) {
                        (t.Inst.equips = e), t.event("equips");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "skillLvs", {
                    get: function () {
                        return t.Inst.skillLvs;
                    },
                    set: function (e) {
                        (t.Inst.skillLvs = e), t.event("skillLvs");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "herolvs", {
                    get: function () {
                        return t.Inst.herolvs;
                    },
                    set: function (e) {
                        (t.Inst.herolvs = e), t.event("herolvs");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "fubens", {
                    get: function () {
                        return t.Inst.fubens;
                    },
                    set: function (e) {
                        (t.Inst.fubens = e), t.event("fubens");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "zpIsOpen", {
                    get: function () {
                        return t.Inst.zpIsOpen;
                    },
                    set: function (e) {
                        (t.Inst.zpIsOpen = e), t.event("zpIsOpen");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "送金刚启动时间", {
                    get: function () {
                        return t.Inst.送金刚启动时间;
                    },
                    set: function (e) {
                        (t.Inst.送金刚启动时间 = e), t.event("送金刚启动时间");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "送金刚广告次数", {
                    get: function () {
                        return t.Inst.送金刚广告次数;
                    },
                    set: function (e) {
                        (t.Inst.送金刚广告次数 = e), t.event("送金刚广告次数");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "送金刚是否完成", {
                    get: function () {
                        return t.Inst.送金刚是否完成;
                    },
                    set: function (e) {
                        (t.Inst.送金刚是否完成 = e), t.event("送金刚是否完成");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "第一场战斗说明是否完成", {
                    get: function () {
                        return t.Inst.第一场战斗说明是否完成;
                    },
                    set: function (e) {
                        (t.Inst.第一场战斗说明是否完成 = e), t.event("第一场战斗说明是否完成");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "herovideounlock", {
                    get: function () {
                        return t.Inst.herovideounlock;
                    },
                    set: function (e) {
                        (t.Inst.herovideounlock = e), t.event("herovideounlock");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "herohelp", {
                    get: function () {
                        return t.Inst.herohelp;
                    },
                    set: function (e) {
                        (t.Inst.herohelp = e), t.event("herohelp");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                Object.defineProperty(t, "herolvexchangevideocount", {
                    get: function () {
                        return t.Inst.herolvexchangevideocount;
                    },
                    set: function (e) {
                        (t.Inst.herolvexchangevideocount = e), t.event("herolvexchangevideocount");
                    },
                    enumerable: !1,
                    configurable: !0
                }),
                (t.newData = !1),
                (t.MusicIsOpen_EventList = []),
                (t.SoundIsOpen_EventList = []),
                (t.jb_EventList = []),
                (t.zs_EventList = []),
                (t.上一次免费抽奖的时间戳_EventList = []),
                (t.所有抽奖宝箱的领取时间_EventList = []),
                (t.旋转转盘时间记录_EventList = []),
                (t.礼包可领取时间戳_EventList = []),
                (t.goldAddTimes_EventList = []),
                (t.diamondAddTimes_EventList = []),
                (t.连续签到的次数_EventList = []),
                (t.上一次签到的时间戳_EventList = []),
                (t.所有已完成的引导_EventList = []),
                (t.hero_EventList = []),
                (t.heros_EventList = []),
                (t.equips_EventList = []),
                (t.skillLvs_EventList = []),
                (t.herolvs_EventList = []),
                (t.fubens_EventList = []),
                (t.zpIsOpen_EventList = []),
                (t.送金刚启动时间_EventList = []),
                (t.送金刚广告次数_EventList = []),
                (t.送金刚是否完成_EventList = []),
                (t.第一场战斗说明是否完成_EventList = []),
                (t.herovideounlock_EventList = []),
                (t.herohelp_EventList = []),
                (t.herolvexchangevideocount_EventList = []),
                t
            );
        })());
o.default = i;
